<% layout('/layouts/default.html', {title: '站修线倒车通知单管理', libs: ['validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text(tblXdZxxdctzd.isNewRecord ? '新增站修线倒车通知单' : '编辑站修线倒车通知单')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${tblXdZxxdctzd}" action="${ctx}/tbl/lineform/tblXdZxxdctzd/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="recId"/>
				<div class="row">
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('运用号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="wagonno"  class="form-control" disabled="disabled" />
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('是否出场')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="isOutStage" dictType="sfcc" blankOption="true" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('出场状况')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="cczk" dictType="cczk" blankOption="true" class="form-control required" onchange="cczkChange()"/>
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('设备号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="deviceNo"  class="form-control" disabled="disabled"/>
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('车辆去向')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="dest" dictType="CLQX" blankOption="true" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
							<span class="required">*</span> ${text('站修类型')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<% var items = [{label:'大修',value:'1'},{label:'中修',value:'2'},{label:'定修',value:'3'},{label:'整修',value:'4'}]; %>
								<#form:select path="vehicleRepairStatus" blankOption="true" items="${items}" itemLabel="label" itemValue="value" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('专项整治')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="zxzz" dictType="ZXZZ" blankOption="true" class="form-control " />
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('是否禁峰')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="isNopeak" dictType="sys_yes_no" blankOption="true" class="form-control required" />
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('备注')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="remark" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-4" id="vehicleRepair">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('转修地点')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="ZXDD" items="${rlcList}" itemLabel="XLMC" itemValue="XLBH" class="form-control " onchange="rlcChange()"/>
								<!--								<#form:input path="repairLineCode" maxlength="10" class="form-control required"/>-->
								<#form:hidden path="ZXDD"/>
							</div>
						</div>
					</div>
					<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<div class="col-sm-8">
									<#form:hidden path="ids"/>
								</div>
						</div>
					</div>
					<!-- <div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required">*</span> ${text('主要故障')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="faultName" maxlength="100" class="form-control" onclick="showGZ()"/>
								<#form:hidden path="faultCode" />
							</div>
						</div>
					</div>
					 -->
				</div>
			</div>
			<div class="box-footer">
				<div class="text-right">
						<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
				</div>
			</div>
		</#form:form>
		<div id="importBox"  data-url="${ctx}/tbl/kclb/tblZdKcyy/listSelect" style="display: none">
		
	</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.showMessage('保存成功。', '', 'success', 4000);
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
				var curIframe=parent.$("div.html_content").filter(function() { return $(this).css("visibility") == "visible"; });	
				curIframe.find('iframe')[0].contentWindow.page();
				var index = parent.layer.getFrameIndex(window.name); //
		        parent.layer.close(index); //
			}
		}, "json");
    }
});

function showGZ(){
	console.log(1111)
	$('#importBox').show();
	js.layer.open({
       type: 2,
       title:['添加主要故障','background-color:#e2e1e1;'],
       align:'center',
       area: ['770px', '689px'], //宽高
       content: $('#importBox').attr('data-url'),
       shade: 0.5 ,
       resize:false,//弹窗不可拖拽
       end : function(){
           $('#importBox').hide();
           
           var code = parent.returnValueC.toString();
           var reason = parent.returnValueR.toString();
           
           $("#faultName").val(reason);
           $("#faultCode").val(code);
           console.log(reason);
           console.log(code);
       }
    },"json");
}
function rlcChange(){
	var XLMC = $("#XLBH").find("option:selected").text();
	$("#XLBH").val(XLMC);
}

cczkChange();

function cczkChange(){
	if($('#cczk').val() == 2){
		$("#vehicleRepair").show();
	}else{
		$("#vehicleRepair").hide();
	}
}
</script>
<style>
	body{
		height: 100%;
	}
	.main-content{
		height: 100%;
	}
	.box{
		height: 100%;
	}
</style>